package sweetcamera.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.Region;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

import com.github.postsanf.yinian.BaseApplication;
import com.github.postsanf.yinian.utils.UIHelper;

public class CircleCameraView extends View {
    private Context mContext;

    public CircleCameraView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
    }

    public CircleCameraView(Context context) {
        this(context, null);
    }

    @Override
    public void draw(Canvas canvas) {
        Log.e("onDraw", "draw: test");
        Path path = new Path();
        //设置裁剪的圆心，半径
        path.addCircle(BaseApplication.mScreenWidth / 2, BaseApplication.mScreenHeight / 2, BaseApplication.mScreenWidth / 4, Path.Direction.CW);
        //裁剪画布，并设置其填充方式
        canvas.clipPath(path, Region.Op.DIFFERENCE);
        super.draw(canvas);
    }
}
